function registe(){
    if(validate()==0)
    	return false;
    var password=$.trim($('#password1').val());
    var account=$.trim($('#phone').val());
    var encode = hex_md5(account+password);
    $.ajax({
    	url:'addUserInfo',
    	method:'post',
    	dataType:'json',
    	data:{
    		accountName:$('#phone').val(),
    		name:$('#name').val(),
    		password:encode,
    		phone:$('#phone').val(),
    		address:$('#address').val(),
    	},
    	success:function(data){
    		if(data.code==0){
    			alert("注册成功")
    			window.location.href='/index'
    		}
    		else
    			alert("注册失败")
    	},
    	error:function(){
    		alert("出错了")
    	}
    	
    });
}

//校验
function validate(){
   var password1=$.trim($('#password1').val());
   var password2=$.trim($('#password2').val());
   var name=$("#name").val();
   var phone=$('#phone').val();
   var address=$('#address').val();
   if(password1!=password2){
	   alert("两次输入的密码不一致")
	   return 0;
   }
   if(name==""||name==undefined){
	   alert("姓名不能为空");
	   return 0;
   }
   if(phone==""||phone==undefined){
	   alert("电话不能为空");
	   return 0;
   }
   if(address==""||address==undefined){
	   alert("住址不能为空");
	   return 0;
   }
   return 1;
}